When creating XML Documents, make sure to:

  • Create the xml document in Notepad (Just a side note: Text Edit for Mac doesn't work very well, so use Notepad on a PC).
  • Begin the document with <?xml version="1.0" encoding="UTF-8"?> called the prolog.
  • Include your name on the next line <!-- Dr. Hornik --> , this is a comment and is not processed by any xml processor.
  • Figure out what the root, parent elements, and child elements are.
  • Know which elements have attributes.
  • Have an opening and closing tag for each element.
  • Close the tag that you last opened before closing any other tags.
  • Use no spaces for the element name, usually it is just "CustomerNumber" (this is referred to as camel format); between the tags though, there can be spaces in the data such as "Betty White."
  • Keep in mind that XML is case sensitive, so pay special attention to case when typing. This can be a common error.
  • Each parsed entity in a well-formed document must itself be well-formed. All parsed entities must be well-formed simply means that when you replace entity references with the entities they stand for, the result must be well-formed.
  • Save the xml document with a .xml extension.
  • Open the xml document using Firefox or Internet Explorer to test it to see if it works. If there is an error, Firefox or Internet Explorer will let you know by showing an error message. If there are no errors, then the document will open up properly. The line number is sometimes given as a helpful hint.
  • There are also third party application, that is some cases can be more helpful in troubleshooting XML documents, and are actually more "friendly" in terms of identifying errors as compared to Internet Explorer or Firefox. Exchanger XML Editor is one such tool, and it was created by a company called Cladonia. While a professional edition exists and must be purchased, there is also a "lite" version available for non commercial use. This can be downloaded by navigating to the following URL: http://www.freexmleditor.com/


Well-formed XML documents must follow basic rules:
  • Can only have one "root" element
    • An element that encloses all other elements, in this case <Students>
    • <Students>
    • ..... other elements
    • </Students>
  • All elements must have matching beginning and ending names, and XML is case sensitive. The ending tag name will be preceded with a / which indicates the tag is closed, that is the content between the <> and </> tags are the data being described by the tags.
    • <StudentName>John Smith</StudentName>
  • Elements can contain "attributes" that add additional data about a specific element and appear following the beginning element name. Attributes always consist of an attribute name and a value in the format: attributeName="attributeValue"
    • <StudentName campus="Main">John Smith</StudentName>
  • All elements must be properly nested. That is the last element opened must be the first element closed - LOFC
    • <Student>
    • <StudentName campus="Main">John Smith</StudentName>
    • </Student>


When creating schema for xml documents, here are a few things to keep in mind:

  • Take each element in an xml document and describe what type of element each one is and if it contains attributes. That is essentially what creating schema is about.
  • Figure out which elements are complex elements, simple elements, or complex elements with simple content.
  • If an element is a simple element, it will look like this: Example:
    <xs:element name="CustomerName" type="xs:string"/> Simple elements are pretty easy because they just have one line and you have opening tags and closing tags on the same line.
  • If an element is a complex element, it should have 3 parts to it: Example:
    <xs:element name="InventoryName">
    <xs:complexType>
    <xs:sequence>
And don't forget to include the closing tag for each one.
  • A complex element means that it contains elements and attributes inside of it. You have to have "sequence" there because all the elements following should go in that order (the order is very important).
  • If an element is a complex element with simple content, it should look like this:
Example:
<xs:element name="StudentGrade">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
<xs:attribute name="category" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

  • The minOccurs and maxOccurs may or may not be there. It depends on what the question tells you.
  • When the xml and schema documents are done, test them both in internet explorer or firefox and then go to the validation website to make sure the schema is well-formed and validated. The validation website is: http://tools.decisionsoft.com/schemaValidate/
  • When your browse for your documents, make sure to put the schema in the schema box and the xml document in the xml document box. If you put them in the wrong spots, you will get a major error.
  • Once you click validate, it will let you know if there are errors to fix. It will tell you which line to go back and fix. If you refresh the internet explorer or firefox page the errors that have been correct will be reflected.
  • After fixing the error, try to validate and see if it works. Continue to fix the errors and try to validate until it works. Once your schema document is validated, you know that it is well-formed and valid.

XSLT PARAMETER DOCUMENTATION:
Extensible Stylesheet Language for Transformations (XSLT) is a subset of the XSL language that is used for performing transformations on XML documents. XSLT is one of the most useful pieces of the XML foundation because it can be used to transform any XML document into a presentation format, such as HTML or PDF, and to rearrange and combine any number of data items from any XML documents into other XML documents. For additional helpful information regarding XSLT Parameter, please visit the following link:
http://www.jenitennison.com/xslt/utilities/paramDoc.html

XSLT Tips
  • All the rules of XML document apply!
  • To keep things simple save you .xml and .xsl files in the same folder and make sure you properly link the the files:
    • In your xml file insert where name.xsl" would be the name of your xslt file
  • Make sure you enter all the namespaces in the XSLT file from the XML document that you are transforming
  • I usually start with the very basics and test my document to make sure it is working before typing too much and having to figure out problems all at once

The following functions can occur in many XSLT attributes such as (xsl:value-of.select and xsl:for-each.select)
Function
Description/ Syntax
Example
ceiling
The ceiling function returns the smallest integer that is equal to or is larger than the numeric value of the number argument.
ceiling(3.57)
concat
Concatenates two or more strings, which are listed in the parentheses
concat($fname,’ ‘, $lname)
count
The count function counts and returns the number of nodes in a node-set.
count(elements)
floor
The floor function returns the largest integer that is equal to or is smaller than the numeric value of the number argument.
floor(3.57)
normalize-space
Removes white-space from the beginning and end of the string
normalize-space($fname)
position
The position function returns the position number in the current node list of the node that is currently being processed by an xsl:for-each or xsl:apply-templates element. There are no arguments.
position()
round
The round function rounds a number to its closest integer.
round(3.57)
string
The string function converts the value argument to a string.
string()
string-length
The string-length function returns the number of characters in a string. The string argument is optional. If omitted, the default is to use the string value of the context node.
string-length(‘hello’)
substring
A segment within a variable value. Substring takes three parameters: the input variable, the first character to be selected, and the length of the resulting string
substring($dob,4,2)
substring-after
The substring-after function returns a portion out of the string specified in the string argument that occurs after the substring specified in the substring argument.
substring-after(‘In 1814 we took a little trip’, ‘we’)
substring-before
The substring-before function returns a portion out of the string specified in the string argument that occurs before the substring specified in the substring argument.
substring-before(‘In 1814 we took a little trip’, ‘we’)
sum
The sum function adds and returns the total value of a set of numeric values in a node-set or list of values.
sum(1,3,7,12)
translate
Takes the string in the value argument, replaces all occurrences of a string specified in the string1 argument with substitute characters specified in string2 argument and returns the modified string.
translate(‘colored armor’, ‘or’, ‘our’)

Title and headings
<TITLE>
title associated with the document
<H1 ALIGN=CENTER>
top-level heading, centered
<H1>
top-level heading
<H2>
second-level heading
<H3>
third-level heading
Blocks of text
<P>
normal paragraph
<BLOCKQUOTE>
quotation from external source
<ADDRESS>
address info about author
<PRE>
preformatted tex
Lists
<UL>
unordered list
<OL>
ordered list
<LI>
list item
<DL>
definition list
<DT>
term in definition list
<DD>
definition data for term
Classification of phrases (text markup)
<EM>
emphasized text
<STRONG>
strongly emphasized text
<CITE>
citation (title of a book or article or equivalent)
<CODE>
computer program code or equivalent
<SAMP>
sample output from e.g. computer program
<KBD>
text to be typed by a user
<I>
text to be presented in italics
<SMALL>
text to be presented in a font smaller than normal
Hypertext links
<A HREF="URL">text</A>
link to a document
<A HREF="URL#name">text</A>
link to a named location in a document
<A HREF="#name">text</A>
link to a named location within the same document
<A NAME="name">text</A>
names a target location for links
Other elements
<IMG SRC="URL" ALT="text">
image to be embedded
<BR>
forced line break
<HR>
change of topic (horizontal rule)

Basic 4x4 Table Example:
<TABLE border="1" width="500">
<TR>
<TD>Row 1, Column 1 Cell contents</TD>
<TD>Row 1, Column 2 Cell contents</TD>
</TR>
<TR>
<TD>Row 2, Column 1 Cell contents</TD>
<TD>Row 2, Column 2 Cell contents</TD>
</TR>
</TABLE>


HELP LINKS AND DOWNLOADABLE FILES:
www.SkipWhite.com/guide2007/downloads:
InventoryWithStylesheet.xml (5-2)
InvCostAndPriceReport.xsl (5-2)

HTML Help: www.htmlhelp.com
http://zvon.org/xxl/XSLTreference/
http://www.xbrl.org.au/training/InstanceDocumentAnatomy.pdf
http://www.w3schools.com/xml/xml_namespaces.asp

XBRL Training for SEC Filers

Self-paced Training for EDGAR filings in the new XBRL format.
www.training-**xbrl**.com

XBRL For Dummies Cheat Sheet - For Dummies
www.dummies.com/how.../**xbrl**-for-dummies-cheat-sheet.html

XBRL FOOTNOTE
You do not need the Context structure for the footnotes as it duplicates the same period as the B/S context, you simply reference that context using the contextRef attribute.